#!/bin/bash
mkdir -p /home/app_start 
cd /home/app_start 
# docker install
curl -fsSL https://get.docker.com -o get-docker.sh && sudo sh get-docker.sh 
sudo systemctl enable docker.service && sudo systemctl enable containerd.service && sudo systemctl start docker
sudo curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose 
sudo chmod +x /usr/local/bin/docker-compose 
# jdk install 
mkdir -p /usr/local/java && curl -o /home/app_start/jdk-8u321-linux-x64.tar.gz -L "https://data.smallblog.cn/blog-images/back/jdk-8u321-linux-x64.tar.gz"  && sudo tar -zxvf jdk-8u321-linux-x64.tar.gz -C /usr/local/java
echo -e "export JAVA_HOME=/usr/local/java/jdk1.8.0_321\nexport CLASS_PATH=.:\$JAVA_HOME/lib/dt.jar:\$JAVA_HOME/lib/tools.jar\nexport PATH=\$JAVA_HOME/bin:\$CLASS_PATH:\$PATH" >> /etc/profile && source /etc/profile && echo -e "source /etc/profile" >> ~/.bashrc && source ~/.bashrc
# mysql
mkdir -p ./build/mysql/data 
# redis
mkdir -p ./build/redis/data && mkdir -p ./build/redis/conf && mkdir -p ./build/redis/logs 
# nginx
mkdir -p ./build/nginx && mkdir -p ./build/nginx/log && mkdir -p ./build/nginx/www 
# minio
mkdir -p ./build/minio/data && mkdir -p ./build/minio/config 
# portainer
mkdir -p ./build/portainer/data && mkdir -p ./build/portainer/public 
# nacos
mkdir -p ./build/nacos
# docker-compose.yml install
curl  -o /home/app_start/docker-compose.yml  -L "https://gitee.com/grocerie/centos-deployment/raw/master/docker-compose.yml"
# nginx install
docker pull docker.io/nginx 
docker run -p 80:80 --name nginx_test -d nginx 
docker container cp nginx_test:/etc/nginx /home/app_start/build
docker stop nginx_test 
docker-compose up -d nginx 
# mysql install
docker-compose up -d mysql 
# redis install 
curl  -o /home/app_start/build/redis/conf/redis.conf  -L "https://gitee.com/grocerie/centos-deployment/raw/master/redis.conf"
docker-compose up -d redis 
# minio install
docker-compose up -d minio 
# portainer install
docker-compose up -d portainer 
curl -o /home/app_start/build/portainer/public.tar -L "https://data.smallblog.cn/blog-images/back/public.tar"  && sudo tar -vxf public.tar -C /home/app_start/build/portainer/ 
docker-compose restart -d portainer
# git install
yum install -y git
# nacos install
## 官方的
# mkdir -p /home/app_start/build/nacos && cd /home/app_start/build/nacos
# git clone --depth 1 https://github.com/nacos-group/nacos-docker.git
# docker-compose -f ./nacos-docker/example/standalone-derby.yaml up
## 自定义的
docker-compose up -d nacos
docker-compose up -d prometheus
docker-compose up -d grafana
